<?php
include_once 'data.php';
include_once 'functions.php';
?>
<div id="display-content" style="width:100%;height:100%">
    <?php
    if (!isset($_GET['project'])) {
        $project = '';
    } else {
        $project = $_GET['project'];
    }

    if (!isset($_SESSION['limit'])) {
        $limit = 10;
    } else {
        settype($_SESSION['limit'], "integer");
        $limit = $_SESSION['limit'];
    }

    if (!isset($_SESSION['orderby'])) {
        $orderby = 'id';
    } else {
        $orderby = $_SESSION['orderby'];
    }

    if (!isset($_SESSION['display'])) {
        $display = 'summary';
    } else {
        $display = $_SESSION['display'];
    }

    if (!isset($_GET['from'])) {
        $from = '0';
    } else {
        settype($_GET['from'], "integer");
        $from = $_GET['from'];
    }

    if ($_GET['select'] != 'library' &&
            $_GET['select'] != 'shelf' &&
            $_GET['select'] != 'desk' &&
            $_GET['select'] != 'clipboard') {

        $_GET['select'] = 'library';
    }

    if (isset($_GET['browse'])) {

        $in = '';
        $all_in = '';
        $specified_in = '';

        database_connect($database_path, 'library');

        $shelf_files = array();
        $shelf_files = read_shelf($dbHandle);

        $desktop_projects = array();
        $desktop_projects = read_desktop($dbHandle);

        if ($_GET['select'] == 'shelf') {

            $in = join (",", $shelf_files);
            $all_in = "WHERE id IN ($in)";
            $specified_in = "AND id IN ($in)";
            $category_specified_in = "($in)";
        }

        if ($_GET['select'] == 'desk') {

            $all_in = "WHERE id IN ()";
            $project_id = $dbHandle->query("SELECT projectID FROM projects ORDER BY project COLLATE NOCASE ASC LIMIT 1");
            $display_project = $project_id->fetchColumn();

            if(isset($_GET['project'])) $display_project = $_GET['project'];
            $project_files = $dbHandle->query("SELECT fileID FROM projectsfiles WHERE projectID=".intval($display_project));
            $project_files = $project_files->fetchAll(PDO::FETCH_COLUMN);
            $in = implode (',', $project_files);
            $all_in = "WHERE id IN ($in)";
            $specified_in = "AND id IN ($in)";
            $category_specified_in = "($in)";
            $project_files = null;

            $project_name = '';
            $project_name = $dbHandle->query("SELECT project FROM projects WHERE projectID=".intval($display_project)." LIMIT 1");
            $project_name = $project_name->fetchColumn();
        }

        if ($_GET['select'] == 'clipboard' && !empty($_SESSION['session_clipboard'])) {
            $in = join (",", $_SESSION['session_clipboard']);
            $all_in = "WHERE id IN ($in)";
            $specified_in = "AND id IN ($in)";
            $category_specified_in = "($in)";
        }

        if ($_GET['select'] == 'clipboard' && empty($_SESSION['session_clipboard'])) {
            $all_in = "WHERE id IN ()";
            $specified_in = "AND id IN ()";
            $category_specified_in = "()";
        }

        $category_sql_array = array();

        //database_connect($database_path, 'library');

        while (list($query, $column) = each($_GET['browse'])) {

            $query2 = str_replace("\\", "\\\\", $query);
            $query2 = str_replace('%', '\%', $query2);
            $query2 = str_replace('_', '\_', $query2);
            $query2 = str_replace("'", "''", $query2);

            if ($column == 'category') {

                $query = intval($query);

                if ($query == 0) {
                    if ($_GET['select'] == 'library') {
                        $category_sql_array[] = "SELECT id FROM library WHERE id NOT IN (SELECT fileID FROM filescategories)";
                    } else {
                        $category_sql_array[] = "SELECT id FROM library WHERE id NOT IN (SELECT fileID FROM filescategories) AND id IN $category_specified_in";
                    }
                    $query_translation = '!unassigned';
                } else {
                    if ($_GET['select'] == 'library') {
                        $category_sql_array[] = "SELECT fileID FROM filescategories WHERE categoryID=$query";
                    } else {
                        $category_sql_array[] = "SELECT fileID FROM filescategories WHERE categoryID=$query AND fileID IN $category_specified_in";
                    }
                    $result = $dbHandle->query("SELECT category FROM categories WHERE categoryID=$query LIMIT 1");
                    $query_translation = $result->fetchColumn();
                    $result = null;
                }
            } elseif ($column == 'keywords') {
                $browse_string_array[]="(keywords LIKE '$query2' ESCAPE '\' OR keywords LIKE '%/ $query2' ESCAPE '\' OR keywords LIKE '%/ $query2 /%' ESCAPE '\' OR keywords LIKE '$query2 /%' ESCAPE '\'
						 OR keywords LIKE '%/$query2' ESCAPE '\' OR keywords LIKE '%/$query2/%' ESCAPE '\' OR keywords LIKE '$query2/%' ESCAPE '\')";
            } elseif ($column == 'authors') {
                $browse_string_array[] = "(authors LIKE '%$query2%' ESCAPE '\' OR authors_ascii LIKE '%$query2%' ESCAPE '\') AND (regexp_match(authors, '$query2', 0) OR regexp_match(authors_ascii, '$query2', 0))";
            } elseif ($column == 'year') {
                $browse_string_array[] = "(year LIKE '$query2%' ESCAPE '\')";
            } else {
                $browse_string_array[] = "$column='$query2'";
            }

            if ($column != 'all') $query_array[] = "$column: ".(empty($query_translation) ? $query : $query_translation);

            $column_string = $column;

            $browse_url_array[] = "browse[".urlencode($query)."]=".urlencode($column);
        }

        $category_sql = implode (" INTERSECT ", $category_sql_array);

        $browse_url_string = join ("&", $browse_url_array);

        if (isset($browse_string_array) && is_array($browse_string_array)) $browse_string = join (' AND ', $browse_string_array);
        if (isset($query_array) && is_array($query_array)) $query_display_string = join (' AND ', $query_array);

        $ordering = 'ASC';
        if ($orderby == 'year' || $orderby == 'addition_date' || $orderby == 'rating' || $orderby == 'id') $ordering = 'DESC';

        $dbHandle->sqliteCreateFunction('regexp_match', 'sqlite_regexp', 3);

        if ($column_string == 'all') {

            if ($from > 0 && isset($_SESSION['export_files_timestamp']) && $_SESSION['export_files_timestamp'] >= filemtime($database_path.'library.sq3')) {
                $total_files_array = $_SESSION['export_files'];
            } else {
                $result = $dbHandle->query("SELECT id FROM library $all_in ORDER BY $orderby COLLATE NOCASE $ordering");
                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();
            }

            $display_files_array = array_slice($total_files_array, $from, $limit);
            $display_files = join (",", $display_files_array);
            $display_files = "id IN ($display_files)";

            $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
					FROM library WHERE $display_files");
        } elseif ($column_string == 'miscellaneous') {

            if (array_key_exists('No PDF', $_GET['browse'])) {

                $pdfs = array ();

                $file_array = scandir($library_path);

                foreach ($file_array as $file) {
                    if (substr($file,-4) == '.pdf') $pdfs[] = $file;
                }

                $pds_string = join ("','", $pdfs);
                $pds_string = "file NOT IN ('".$pds_string."')";

                $result = $dbHandle->query("SELECT id FROM library WHERE $pds_string ORDER BY $orderby COLLATE NOCASE $ordering");

                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();

                $display_files_array = array_slice($total_files_array, $from, $limit);
                $display_files = join (",", $display_files_array);
                $display_files = "id IN ($display_files)";

                $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
						FROM library WHERE $display_files");
            }

            if (array_key_exists('My Items', $_GET['browse'])) {

                $result = $dbHandle->query("SELECT id FROM library WHERE added_by=".intval($_SESSION['user_id'])." ORDER BY $orderby COLLATE NOCASE $ordering");

                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();

                $display_files_array = array_slice($total_files_array, $from, $limit);
                $display_files = join (",", $display_files_array);
                $display_files = "id IN ($display_files)";

                $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
						FROM library WHERE $display_files");
            }

            if (array_key_exists("Others' Items", $_GET['browse'])) {

                $result = $dbHandle->query("SELECT id FROM library WHERE added_by!=".intval($_SESSION['user_id'])." ORDER BY $orderby COLLATE NOCASE $ordering");

                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();

                $display_files_array = array_slice($total_files_array, $from, $limit);
                $display_files = join (",", $display_files_array);
                $display_files = "id IN ($display_files)";

                $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
						FROM library WHERE $display_files");
            }

            if (array_key_exists('Not in Shelf', $_GET['browse'])) {

                $not_shelf = join(",", $shelf_files);
                $not_shelf = "id NOT IN(".$not_shelf.")";

                $result = $dbHandle->query("SELECT id FROM library WHERE $not_shelf ORDER BY $orderby COLLATE NOCASE $ordering");

                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();

                $display_files_array = array_slice($total_files_array, $from, $limit);
                $display_files = join (",", $display_files_array);
                $display_files = "id IN ($display_files)";

                $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
						FROM library WHERE $display_files");
            }

            if (array_key_exists('Not Indexed', $_GET['browse'])) {

                $dbHandle->exec("ATTACH DATABASE '".$database_path."fulltext.sq3' AS fulltextdatabase");

                $result = $dbHandle->query("SELECT fileID FROM fulltextdatabase.full_text");
                $indexed = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $dbHandle->exec("DETTACH DATABASE '".$database_path."fulltext.sq3'");

                $not_indexed = join(",", $indexed);
                $not_shelf = "id NOT IN(".$not_indexed.")";

                $result = $dbHandle->query("SELECT id FROM library WHERE $not_shelf ORDER BY $orderby COLLATE NOCASE $ordering");

                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();

                $display_files_array = array_slice($total_files_array, $from, $limit);
                $display_files = join (",", $display_files_array);
                $display_files = "id IN ($display_files)";

                $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
						FROM library WHERE $display_files");
            }

        } else {

            if ($from > 0 && isset($_SESSION['export_files_timestamp']) && $_SESSION['export_files_timestamp'] >= filemtime($database_path.'library.sq3')) {
                $total_files_array = $_SESSION['export_files'];
            } else {

                if (!empty($category_sql)) {
                    $result = $dbHandle->query("SELECT id FROM library WHERE id IN (".$category_sql.") ORDER BY $orderby COLLATE NOCASE $ordering");
                } else {
                    $result = $dbHandle->query("SELECT id FROM library WHERE $browse_string $specified_in ORDER BY $orderby COLLATE NOCASE $ordering");
                }

                $total_files_array = $result->fetchAll(PDO::FETCH_COLUMN);
                $result = null;
                $_SESSION['export_files'] = $total_files_array;
                $_SESSION['export_files_timestamp'] = time();
            }

            $display_files_array = array_slice($total_files_array, $from, $limit);
            $display_files = join (",", $display_files_array);
            $display_files = "id IN ($display_files)";

            $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating
						FROM library WHERE $display_files");
        }

        $rows = count($total_files_array);
        $result = $result->fetchAll(PDO::FETCH_ASSOC);
        $dbHandle = null;

        $tempresult = array();
        foreach($result as $row) {
            $key = array_search($row['id'], $display_files_array);
            $tempresult[$key] = $row;
        }
        ksort($tempresult);
        $result = $tempresult;

        if ($rows > 0) {
            ?>
    <table cellspacing="1" id="customization" style="border-spacing:2px 0px;cursor:pointer">
        <tr>
            <td class="ui-state-highlight" id="displaybutton">&nbsp;Display&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $display == 'brief' ? 'off' : 'on'; ?>" style="float:left"></span>Title&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $display == 'summary' ? 'off' : 'on'; ?>" style="float:left"></span>Summary&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $display == 'abstract' ? 'off' : 'on'; ?>" style="float:left"></span>Abstract&nbsp;</td>
            <td class="ui-state-highlight" id="orderbybutton">&nbsp;Order by&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $orderby == 'year' ? 'off' : 'on'; ?>" style="float:left"></span>Date Published&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $orderby == 'id' ? 'off' : 'on'; ?>" style="float:left"></span>Date Added&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $orderby == 'rating' ? 'off' : 'on'; ?>" style="float:left"></span>Rating&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $orderby == 'journal' ? 'off' : 'on'; ?>" style="float:left"></span>Journal&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $orderby == 'authors' ? 'off' : 'on'; ?>" style="float:left"></span>Authors&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $orderby == 'title' ? 'off' : 'on'; ?>" style="float:left"></span>Title&nbsp;</td>
            <td class="ui-state-highlight" id="showbutton">&nbsp;Show&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $limit == 5 ? 'off' : 'on'; ?>" style="float:left"></span>5&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $limit == 10 ? 'off' : 'on'; ?>" style="float:left"></span>10&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $limit == 15 ? 'off' : 'on'; ?>" style="float:left"></span>15&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $limit == 20 ? 'off' : 'on'; ?>" style="float:left"></span>20&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $limit == 50 ? 'off' : 'on'; ?>" style="float:left"></span>50&nbsp;</td>
            <td class="alternating_row"><span class="ui-icon ui-icon-radio-<?php print $limit == 100 ? 'off' : 'on'; ?>" style="float:left"></span>100&nbsp;</td>
        </tr>
    </table>
    <script type="text/javascript">
        $('#customization').data('redirection','<?php print preg_replace('/(from=\d*)(\&|$)/', 'from=0$2', basename($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING']); ?>')
        .find('span.ui-icon-radio-on').closest('td').find("td:not([id])").andSelf().hide();
    </script>
            <?php
        }

        if (isset($_GET['select']) && $_GET['select'] == 'shelf' && isset($_SESSION["auth"])) {
            $what = "Shelf";
        } elseif (isset($_GET['select']) && $_GET['select'] == 'clipboard') {
            $what = "Clipboard";
        } elseif (isset($_GET['select']) && $_GET['select'] == 'desk') {
            $what = htmlspecialchars("Project: $project_name");
        } else {
            $what = "Library";
        }

        print '<div id="list-title" style="font-weight: bold; padding: 2px">'.$what;

        if (!empty($query_display_string)) print ' &raquo; '.htmlspecialchars($query_display_string);

        print '</div>';

        if ($rows > 0) {

            $items_from = $from+1;
            (($from + $limit) > $rows) ? $items_to = $rows : $items_to = $from + $limit;

            print '<table cellspacing="0" class="top" style="margin-bottom:1px"><tr><td style="width: 21em">';

            print '<div class="ui-state-highlight ui-corner-top'.($from == 0 ? ' ui-state-disabled' : '').'" style="float:left;margin-left:2px;width:28px">'
                    .($from == 0 ? '' : '<a href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=0&$browse_url_string").'" class="navigation" style="display:block">').
                    '<span class="ui-icon ui-icon-triangle-1-w" style="float:right;width:16px"></span>
			<span class="ui-icon ui-icon-triangle-1-w" style="float:left;width:10px;overflow:hidden"></span>'
                    .($from == 0 ? '' : '</a>').
                    '</div>';

            print '<div class="ui-state-highlight ui-corner-top'.($from == 0 ? ' ui-state-disabled' : '').'" style="float:left;margin-left:2px;width:5.1em">'
                    .($from == 0 ? '' : '<a class="navigation" href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=".($from-$limit)."&$browse_url_string").'" style="color:black;display:block;width:100%">').
                    '<span class="ui-icon ui-icon-triangle-1-w" style="float:left"></span>Back&nbsp;'
                    .($from == 0 ? '' : '</a>').
                    '</div>';

            if (isset($_SESSION['auth'])) print '<div id="exportbutton" class="ui-state-highlight ui-corner-top" style="float:left;margin-left:2px">
			 <span class="ui-icon ui-icon-suitcase" style="float:left"></span>Export&nbsp;
			</div>
			<div class="ui-state-highlight ui-corner-top" style="float:left;margin-left:2px" id="printlist">
			 <span class="ui-icon ui-icon-print" style="float:left"></span>Print&nbsp;
			</div>';

            print '</td><td style="text-align: center">Items '.$items_from.'-'.$items_to.' of <span id="total-items">'.$rows.'</span>.</td><td style="width:22em">';

            (($rows % $limit) == 0) ? $lastpage = $rows - $limit : $lastpage = $rows - ($rows % $limit);

            print '<div class="ui-state-highlight ui-corner-top'.(($rows > ($from + $limit)) ? '' : ' ui-state-disabled').'" style="float:right;margin-right:2px;width:29px">'
                    .(($rows > ($from + $limit)) ? '<a class="navigation" href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=$lastpage&$browse_url_string").'">' : '').
                    '<span class="ui-icon ui-icon-triangle-1-e" style="float:right;width:16px"></span>
			   <span class="ui-icon ui-icon-triangle-1-e" style="float:left;width:11px;overflow:hidden"></span>'
                    .(($rows > ($from + $limit)) ? '</a>' : '').
                    '</div>';

            print '<div class="ui-state-highlight ui-corner-top'.(($rows > ($from + $limit)) ? '' : ' ui-state-disabled').'" style="width:5.1em;float:right;margin-right:2px">'
                    .(($rows > ($from + $limit)) ? '<a class="navigation" href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=".($from+$limit)."&$browse_url_string").'" style="color:black;display:block;width:100%">' : '').
                    '<span class="ui-icon ui-icon-triangle-1-e" style="float:right"></span>&nbsp;Next'
                    .(($rows > ($from + $limit)) ? '</a>' : '').
                    '</div>';

            print '<div class="ui-state-highlight ui-corner-top" id="pgdown" style="float: right;width: 5em;margin-right:2px">PgDown</div>';

            if (isset($_SESSION['auth'])) print '<div id="omnitoolbutton" class="ui-state-highlight ui-corner-top" style="float:right;margin-right:2px">'
                        .'<span class="ui-icon ui-icon-wrench" style="float:left"></span>Omnitool&nbsp;</div>';

            print '</td></tr></table>';

            database_connect($database_path, 'library');
            show_search_results($result, $_GET['select'], $display, '', $shelf_files, $desktop_projects, $dbHandle);

            print '<table cellspacing="0" class="top" style="margin:1px 0px 2px 0px"><tr><td style="width: 50%">';

            print '<div class="ui-state-highlight ui-corner-bottom'.($from == 0 ? ' ui-state-disabled' : '').'" style="float:left;margin-left:2px;width:28px">'
                    .($from == 0 ? '' : '<a href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=0&$browse_url_string").'" class="navigation" style="display:block">').
                    '<span class="ui-icon ui-icon-triangle-1-w" style="float:right;width:16px"></span>
			<span class="ui-icon ui-icon-triangle-1-w" style="float:left;width:10px;overflow:hidden"></span>'
                    .($from == 0 ? '' : '</a>').
                    '</div>';

            print '<div class="ui-state-highlight ui-corner-bottom'.($from == 0 ? ' ui-state-disabled' : '').'" style="float:left;margin-left:2px;width:5.1em">'
                    .($from == 0 ? '' : '<a class="navigation" href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=".($from-$limit)."&$browse_url_string").'" style="color:black;display:block;width:100%">').
                    '<span class="ui-icon ui-icon-triangle-1-w" style="float:left"></span>Back&nbsp;'
                    .($from == 0 ? '' : '</a>').
                    '</div>';

            print '</td><td style="width:50%">';

            print '<div class="ui-state-highlight ui-corner-bottom'.(($rows > ($from + $limit)) ? '' : ' ui-state-disabled').'" style="float:right;margin-right:2px;width:29px">'
                    .(($rows > ($from + $limit)) ? '<a class="navigation" href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=$lastpage&$browse_url_string").'">' : '').
                    '<span class="ui-icon ui-icon-triangle-1-e" style="float:right;width:16px"></span>
			   <span class="ui-icon ui-icon-triangle-1-e" style="float:left;width:11px;overflow:hidden"></span>'
                    .(($rows > ($from + $limit)) ? '</a>' : '').
                    '</div>';

            print '<div class="ui-state-highlight ui-corner-bottom'.(($rows > ($from + $limit)) ? '' : ' ui-state-disabled').'" style="width:5.1em;float:right;margin-right:2px">'
                    .(($rows > ($from + $limit)) ? '<a class="navigation" href="'.htmlspecialchars("display.php?select=$_GET[select]&project=$project&from=".($from+$limit)."&$browse_url_string").'" style="color:black;display:block;width:100%">' : '').
                    '<span class="ui-icon ui-icon-triangle-1-e" style="float:right"></span>&nbsp;Next'
                    .(($rows > ($from + $limit)) ? '</a>' : '').
                    '</div>';

            print '<div class="ui-state-highlight ui-corner-bottom" id="pgup" style="float:right;width:5em;margin-right:2px">PgUp</div>';

            print '</td></tr></table>';

        } else {
            print '<div style="position:relative;top:43%;left:40%;color:#bfbeb9;font-size:28px;width:200px"><b>No Items</b></div>';
        }
    }

    ?>
</div>